home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
internet
/
yam_i_dodatki
/
yamnet
/
rexx
/
diff.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1990-03-18
|
2KB
|
76 lines
/* Diff.rexx */
/*
Format
DIFF <file1> <file2> [BUFFER <n>] [LINES <n>] [QUICK]
[TO <file3>]
Report differences between files.
*/
signal on break_c; signal on break_d; signal on break_e; signal on break_f
call addlib 'rexxextra.library',-20,-30,0
facility = 'Diff'
retcode = 0
template = "QUICK/S,BUFFER/K,LINES/K,TO/K,FILE1/A,FILE2/A"
dtemplate = "FILE1/A,FILE2/A,TO/K,BUFFER/K,LINES/K,QUICK/S"
args. = ''
parse arg g_c
do while g_c='?'
options prompt dtemplate': ' /* this template is */
parse pull g_c /* displayed to the user */
if g_c='?' then do
g_s=sourceline(3)
if pos('/*',g_s)=0 then break; if pos('*/',g_s)>0 then break
say
g_s=sourceline(4)
do i=5 while pos('*/',g_s)=0; say g_s; g_s=sourceline(i); end
say
end
end
interpret Cparse(g_c,template,'args')
if args.ERRCODE > 1 then do; say facility'-E-BADARGS,' args.ERRTEXT; exit 5; end
cmd = ''
program = 'c:DIFF'
if args.QUICK then cmd = cmd '-w -p'
if args.BUFFER ~= '' then do
if ~datatype(args.BUFFER,'N') then do
say facility'-E-BADNUM, BUFFER arg must be numeric'
exit 10
end
cmd = cmd '-b' || args.BUFFER
end
if args.LINES ~= '' then do
if ~datatype(args.LINES,'N') then do
say facility'-E-BADNUM, LINES arg must be numeric'
exit 10
end
cmd = cmd '-l' || args.LINES
end
if args.TO ~= '' then cmd = cmd '-o' || args.TO
cmd = cmd args.FILE1 args.FILE2
program cmd
GetOut:
exit retcode
break_c:
break_d:
break_e:
break_f:
say facility'-E-BREAK, Control-C interrupt'
exit 20
failure:
say facility'-E-FAIL, Line:' sigl', Error:' rc; retcode = rc; signal GetOut
syntax:
say facility'-E-SYNTAX, Line:' sigl', Error:' rc; retcode = rc; signal GetOut
error:
say facility'-E-ERROR, Line:' sigl', Error:' rc; retcode = rc; signal GetOut